<?php
require_once(CLASSES . 'simpletest/autorun.php');
require_once(CLASSES . 'simpletest/browser.php');
//require_once('../classes/log.php');

class TestOfAuth extends UnitTestCase {
	/*
  function setUp() {
    $objSession = User_Session::instance();
	  $objSession->logOut(true);
  }
    
  function tearDown() {
  }
	*/
  function testSuccessLogIn() {
 	  $browser = new SimpleBrowser();
 	  echo W_FULLPATH;
    $browser->get(W_FULLPATH . 'auth/sign_in/');
    $this->assertFalse(User_Session::isAsciiLoggedIn($browser->getCurrentCookieValue('PHPSESSID')));
    $browser->setFieldById('User_User_login_or_e_mail', 'cms_admin');
    $browser->setFieldById('User_User_pass', '123456');
    $browser->clickSubmitById('User_User_enter');
    
    $this->assertTrue(User_Session::isAsciiLoggedIn($browser->getCurrentCookieValue('PHPSESSID')));
    
	}
	
	/*
    function testNewUserAddedToAuthenticator() {
        $browser = new SimpleBrowser();
        $browser->get('http://my-site.com/register.php');
        $browser->setField('email', 'me@here');
        $browser->setField('password', 'Secret');
        $browser->click('Register');
        
        //$authenticator = new Authenticator();
        //$member = $authenticator->findByEmail('me@here');
        //$this->assertEqual($member->getPassword(), 'Secret');
    }
    */
	/*
  function testFailLogInLogIn() {
		$objSession = User_Session::instance();
	  $objSession->logIn('cms_admin', md5('wrong_password'));
	  $this->assertFalse($objSession->isLoggedIn());
	  $objSession->logIn('wrong_login', md5('123456'));
	  $this->assertFalse($objSession->isLoggedIn());
	}
	*/
}
?>